/**
 * Copyright (c) 2006 RiseSoft Co.,Ltd  
 * $Header$
 */
package cn.newtest.bi.collection.model;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;

/**
 * 直报服务
 *
 * @author <a href="mailto: chenjian@risesoft.net">陈健</a>
 * @version $Revision$
 * 
 */
@Entity
@org.hibernate.annotations.Entity(dynamicInsert=true,dynamicUpdate=true)
@Table(name="rpt_Service")
@Cache(usage=CacheConcurrencyStrategy.READ_WRITE)
public class Service implements Serializable , Cloneable {
	
	private static final long serialVersionUID = 5743104994157975212L;

	@Id
	@Column(name="Service_GUID",length=38)
	@GenericGenerator(name="Service-assigned",strategy="assigned")
	private String guid;
	
	@Column(name="Service_Name",length=40)
	private String name;
	
	@Column(name="Service_Code",length=50)
	private String code;
	
	@Basic
	private Double tabIndex;
	
	@OneToMany(cascade=CascadeType.REMOVE,fetch=FetchType.LAZY,mappedBy="service")
	@OrderBy("tabIndex")
	private List<Application> applications;
	
	public List<Application> getApplications() {
		return applications;
	}

	public void setApplications(List<Application> applications) {
		this.applications = applications;
	}

	public String getGuid() {
		return guid;
	}

	public void setGuid(String guid) {
		this.guid = guid;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public Double getTabIndex() {
		return tabIndex;
	}

	public void setTabIndex(Double tabIndex) {
		this.tabIndex = tabIndex;
	}

	public Service cloneNoPersistence() throws Exception {
		Service service = (Service) this.clone();
		service.setApplications(null);
		return service;
	}
}